# 标准库：图片处理 pillow
"""
标准库：
    1、图片处理 pillow
    2、chr ord
    3、hashlib
    4、md5、hexdigest
"""
# chr ord

print(chr(65))  # unicode码 ->str
print(ord('A'))  # str ->unicode
print(ord('下'))  # 19979
print(chr(19979))

# 标准库： print() input list str set dict tuple ord bin hex oct isinstance


# hashlib :incode decode


# 加密算法：单项 md5 不可逆  base64 可逆
import hashlib

message = '你好中午有事吗？'

md5 = hashlib.md5(message.encode('utf-8'))

print(md5.hexdigest())  # 16进制加密后的值：e1a4a39907786e8a84faf9ea22678ad9
print(len(md5.hexdigest()))  # 32
sha1 = hashlib.sha1(message.encode('utf-8'))
print(sha1.hexdigest())  # 16进制加密后的值：5870d68c81ffb0522968b65938c5498ed13ee6be
print(len(sha1.hexdigest()))  # 40
sha256 = hashlib.sha256(message.encode('utf-8'))
print(sha256)  # <sha256 HASH object @ 0x000002700CB78900>
print(sha256.hexdigest())  # 47d5d4f92f2d9158a87f6090e77e831864d225f481ccf861b07d4a58bc60f44c
print(len(sha256.hexdigest()))  # 64

password = '123456'

lst = []
sha256 = hashlib.sha256(password.encode("utf-8"))
lst.append(sha256.hexdigest())

pwd = input("请输入密码：")
sha256 = hashlib.sha256(pwd.encode("utf-8"))
pwd = sha256.hexdigest()

for i in lst:
    if i == pwd:
        print("登录成功！")
    else:
        print("登录失败")


import pollow